#define LUA_COMBINE(a, b)	LUA_COMBINE1(a, b)
#define LUA_COMBINE1(a, b)	a##b

#define LUA_DELEGATE LUA_COMBINE(LuaDelegate, LUA_SUFFIX)

LUA_TEMPLATE LUA_TEMPLATE_PARAMS
class LUA_DELEGATE : public LuaDelegate
{
public:
	LUA_DELEGATE()
	{
	}
    
    ~LUA_DELEGATE()
    {
    }

	void operator()( LUA_PARAMS )
	{
		for (LuaHandlerVector::iterator iter = mHandlers.begin();
			iter != mHandlers.end(); ++iter)
		{
#if LUA_SUFFIX
			(*iter)->invoke<LUA_TEMPLATE_TYPES>(LUA_ARGS);
#else
			(*iter)->invoke();
#endif
		}

		merge_handlers();
	}
};

#undef LUA_COMBINE
#undef LUA_DELEGATE

#undef LUA_SUFFIX
#undef LUA_TEMPLATE
#undef LUA_TEMPLATE_TYPES
#undef LUA_TEMPLATE_PARAMS
#undef LUA_TEMPLATE_ARGS
#undef LUA_PARAMS
#undef LUA_ARGS
#undef LUA_TEMPLATE